def read_func(path):
    res = [None]*100
    with open(path, "r") as f:
        while True:
            try:
                f.readline()
                f.readline()
                id = int(f.readline().strip().split(' ')[1])
                name = f.readline().strip().split('"')[1]
                print(id, name)
                res[id] = name
                f.readline()
            except:
                break
    return res

path = "label_map.pbtxt"
import json
with open("label.json", 'w+') as label:
    l = read_func(path)
    print(l)
    print(json.dumps(l), file=label)
